package com.base.social.domain;

import java.io.Serializable;

/**
 * 授权所需的token
 *
 * @author becker
 * @since 0.0.1
 */
public class AuthToken implements Serializable {
    private String accessToken;
    private int expireIn;
    private String refreshToken;
    private String uid;
    private String openId;
    private String accessCode;
    private String unionId;
    private String scope;


    /**
     * 小米附带属性
     */
    private String macAlgorithm;
    private String macKey;

    /**
     * 企业微信附带属性
     *
     * @since 0.0.1
     */
    private String code;


    AuthToken(String accessToken, int expireIn, String refreshToken, String uid, String openId, String accessCode,
              String unionId, String scope, String macAlgorithm, String macKey, String code) {
        this.accessToken = accessToken;
        this.expireIn = expireIn;
        this.refreshToken = refreshToken;
        this.uid = uid;
        this.openId = openId;
        this.accessCode = accessCode;
        this.unionId = unionId;
        this.scope = scope;
        this.macAlgorithm = macAlgorithm;
        this.macKey = macKey;
        this.code = code;
    }

    public static AuthTokenBuilder builder() {
        return new AuthTokenBuilder();
    }

    public String getAccessToken() {
        return this.accessToken;
    }

    public int getExpireIn() {
        return this.expireIn;
    }

    public String getRefreshToken() {
        return this.refreshToken;
    }

    public String getUid() {
        return this.uid;
    }

    public String getOpenId() {
        return this.openId;
    }

    public String getAccessCode() {
        return this.accessCode;
    }

    public String getUnionId() {
        return this.unionId;
    }

    public String getScope() {
        return this.scope;
    }

    public String getMacAlgorithm() {
        return this.macAlgorithm;
    }

    public String getMacKey() {
        return this.macKey;
    }

    public String getCode() {
        return this.code;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public void setExpireIn(int expireIn) {
        this.expireIn = expireIn;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public void setAccessCode(String accessCode) {
        this.accessCode = accessCode;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public void setMacAlgorithm(String macAlgorithm) {
        this.macAlgorithm = macAlgorithm;
    }

    public void setMacKey(String macKey) {
        this.macKey = macKey;
    }

    public void setCode(String code) {
        this.code = code;
    }


    public static class AuthTokenBuilder {
        private String accessToken;
        private int expireIn;
        private String refreshToken;
        private String uid;
        private String openId;
        private String accessCode;
        private String unionId;
        private String scope;
        private String macAlgorithm;
        private String macKey;
        private String code;

        AuthTokenBuilder() {
        }

        public AuthToken.AuthTokenBuilder accessToken(String accessToken) {
            this.accessToken = accessToken;
            return this;
        }

        public AuthToken.AuthTokenBuilder expireIn(int expireIn) {
            this.expireIn = expireIn;
            return this;
        }

        public AuthToken.AuthTokenBuilder refreshToken(String refreshToken) {
            this.refreshToken = refreshToken;
            return this;
        }

        public AuthToken.AuthTokenBuilder uid(String uid) {
            this.uid = uid;
            return this;
        }

        public AuthToken.AuthTokenBuilder openId(String openId) {
            this.openId = openId;
            return this;
        }

        public AuthToken.AuthTokenBuilder accessCode(String accessCode) {
            this.accessCode = accessCode;
            return this;
        }

        public AuthToken.AuthTokenBuilder unionId(String unionId) {
            this.unionId = unionId;
            return this;
        }

        public AuthToken.AuthTokenBuilder scope(String scope) {
            this.scope = scope;
            return this;
        }

        public AuthToken.AuthTokenBuilder macAlgorithm(String macAlgorithm) {
            this.macAlgorithm = macAlgorithm;
            return this;
        }

        public AuthToken.AuthTokenBuilder macKey(String macKey) {
            this.macKey = macKey;
            return this;
        }

        public AuthToken.AuthTokenBuilder code(String code) {
            this.code = code;
            return this;
        }

        public AuthToken build() {
            return new AuthToken(accessToken, expireIn, refreshToken, uid, openId, accessCode, unionId, scope,
                    macAlgorithm, macKey, code);
        }

        public String toString() {
            return "AuthToken.AuthTokenBuilder(accessToken=" + this.accessToken + ", expireIn=" + this.expireIn +
                    ", refreshToken=" + this.refreshToken + ", com.tcm.uid=" + this.uid + ", openId=" + this.openId +
                    ", accessCode=" + this.accessCode + ", unionId=" + this.unionId + ", scope=" + this.scope +
                    ", macAlgorithm=" + this.macAlgorithm + ", macKey=" + this.macKey + ", code=" + this.code + ")";
        }
    }
}